package winOrDie.Net.Server;

import java.net.Socket;

import winOrDie.Net.Client.WoD_Peer;

public class WoD_Server_Client extends WoD_Peer
{
	/**
	 ***************************************************************************************************************
	 * Peer client communication parameters
	 ***************************************************************************************************************
	 */
	private int udp_port = -1;
	private int tcp_port = -1;
	private Socket tcp_Socket = null;

	/**
	 ***************************************************************************************************************
	 * {@link WoD_Server_ControlChannel} in case of TCP communications
	 ***************************************************************************************************************
	 */
	private WoD_Server_ControlChannel  woDServerControlChannel = null;
	
	/**
	 *  Delay and offset variables
	 */
	private int delay = -1;
	private int offset = 0;
	
	
	
	/**
	 * Synchronized flag
	 */
	private boolean sync = false;
	
	
	public int getTcp_port() {
		return tcp_port;
	}

	public void setTcp_port(int tcpPort) {
		tcp_port = tcpPort;
	}

	public int getUdp_port() {
		return udp_port;
	}
	
	public void setUdp_port(int udpPort) {
		udp_port = udpPort;
	}

	public Socket getTcp_Socket() {
		return tcp_Socket;
	}

	public void setTcp_Socket(Socket tcpSocket) {
		tcp_Socket = tcpSocket;
	}


	public WoD_Server_ControlChannel getWoDServerControlChannel() {
		return woDServerControlChannel;
	}

	public int getDelay() {
		return delay;
	}

	public void setDelay(int delay) {
		this.delay = delay;
	}

	public int getOffset() {
		return offset;
	}

	public void setOffset(int offset) {
		this.offset = offset;
	}
	public boolean isSync() {
		return sync;
	}
	public void setSync(boolean sync) {
		this.sync = sync;
	}

	/**
	 * TCP socket mode constructor
	 * @param socket
	 * @throws Exception
	 */
	public WoD_Server_Client(Socket socket) throws Exception  
	{
		tcp_Socket = socket;
		setUserName(new String());
		woDServerControlChannel = new WoD_Server_ControlChannel(this);
	}

	/**
	 * Scribe mode constructor
	 * @param scribeNode_ID
	 * @throws Exception
	 */
	public WoD_Server_Client(String scribeNode_ID)
	{
		setScribeNode_ID(scribeNode_ID);
	}
	
	
	/**
	 * Scribe mode constructor from {@link WoD_Peer} object passed as parameter
	 * @param woDPeer
	 */
	public WoD_Server_Client(WoD_Peer woDPeer)
	{
		setUserName(woDPeer.getUserName());
		setCliend_Id(woDPeer.getCliend_Id());
		setScribeNode_ID(woDPeer.getScribeNode_ID());
		setHostDirection(woDPeer.getHostDirection());
		setVoice_UDP_Port(woDPeer.getVoice_UDP_Port());
		setTcp_backup(woDPeer.getTcp_backup());
		setTeam(woDPeer.getTeam());
		setROL(woDPeer.getROL());
		setReadyToGo(woDPeer.isReadyToGo());
	}
	
	public WoD_Server_Client() 
	{
		
	}
}
